package com.wwp.tbshop.activity;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.widget.ImageView;

import com.wwp.tbshop.R;
import com.wwp.tbshop.accout_center.fragment.Login_frament;
import com.wwp.tbshop.accout_center.fragment.Register_frament;
import com.wwp.tbshop.accout_center.adapter.Login_register_Adapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 6/17/2017.
 */

public class RegisterOrLoginActivity extends Activity {


    @Bind(R.id.tab_layout)
    TabLayout mTabLayout;
    @Bind(R.id.view_pager)
    ViewPager mViewPager;
    @Bind(R.id.weixin)
    ImageView mWeixin;
    @Bind(R.id.qq)
    ImageView mQq;
    @Bind(R.id.weibo)
    ImageView mWeibo;
    @Bind(R.id.back)
    ImageView mBack;


    private List<Fragment> mFragmentList = new ArrayList<>();
    private Login_register_Adapter mLogin_register_adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register_login_activity);
        ButterKnife.bind(this);

        initFragment();

        mLogin_register_adapter = new Login_register_Adapter(getFragmentManager());
        mLogin_register_adapter.setFragmentList(mFragmentList, this); // mfragmentlist viewpager的内容

        mViewPager.setAdapter(mLogin_register_adapter);
        mTabLayout.setupWithViewPager(mViewPager);

    }

    private void initFragment() {

        mFragmentList.clear();
        mFragmentList.add(new Login_frament(this));
        mFragmentList.add(new Register_frament(this));
    }

    @OnClick(R.id.back)
    public void onClick() {
        finish();
    }
}
